x86, 32-on-64: Improve checking in vcpu_destroy_pagetables(). It *is*
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 20 Nov 2007 15:34:25 +0000 (15:34 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 20 Nov 2007 15:34:25 +0000 (15:34 +0000)
possible for 64-bit guest to have matching guest_table and
guest_table_user.
Original patch by John Levon <levon@movementarian.org>
Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
xen/arch/x86/domain.c

index aaf7c979c613e2c8030d48e42f78437c6111f7e9..6b4fded0dc0d48492e117b609b8f020c970a0951 100644 (file)
@@ -1756,10 +1756,6 @@ static void vcpu_destroy_pagetables(struct vcpu *v)
             put_page(mfn_to_page(pfn));
         else
             put_page_and_type(mfn_to_page(pfn));
-#ifdef __x86_64__
-        if ( pfn == pagetable_get_pfn(v->arch.guest_table_user) )
-            v->arch.guest_table_user = pagetable_null();
-#endif
         v->arch.guest_table = pagetable_null();
     }
 
@@ -1768,10 +1764,13 @@ static void vcpu_destroy_pagetables(struct vcpu *v)
     pfn = pagetable_get_pfn(v->arch.guest_table_user);
     if ( pfn != 0 )
     {
-        if ( paging_mode_refcounts(d) )
-            put_page(mfn_to_page(pfn));
-        else
-            put_page_and_type(mfn_to_page(pfn));
+        if ( !is_pv_32bit_vcpu(v) )
+        {
+            if ( paging_mode_refcounts(d) )
+                put_page(mfn_to_page(pfn));
+            else
+                put_page_and_type(mfn_to_page(pfn));
+        }
         v->arch.guest_table_user = pagetable_null();
     }
 #endif